﻿using SLNGP.Core.GeneticPrograms;

namespace SLNGP.Core.GeneticOpearators
{
    public abstract class SelectionGeneticOpearator : GeneticOpearator, ISelectionGeneticOpearator
    {
        protected SelectionGeneticOpearator(int crossoverPercentage, int mutationPercentage, int carryUnchangedPercentage, int killPercentage)
        {
            CarryUnchangedPercentage = carryUnchangedPercentage;
            KillPercentage = killPercentage;
            MutationPercentage = mutationPercentage;
            CrossoverPercentage = crossoverPercentage;

            if (carryUnchangedPercentage + killPercentage + mutationPercentage + crossoverPercentage != 100)
                throw new GeneticProgrammingException("Selection percentages must total in 100.");
        }

        public int CarryUnchangedPercentage { get; set; }
        public int KillPercentage { get; set; }
        public int MutationPercentage { get; set; }
        public int CrossoverPercentage { get; set; }
    }
}